home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / learnvb5 / example4.frm (.txt) < prev    next >
Visual Basic Form  |  1998-06-08  |  5KB  |  152 lines

  1. VERSION 5.00
  2. Begin VB.Form frmImage 
  3.    Caption         =   "Image Viewer"
  4.    ClientHeight    =   4140
  5.    ClientLeft      =   1140
  6.    ClientTop       =   1545
  7.    ClientWidth     =   6690
  8.    LinkTopic       =   "Form1"
  9.    PaletteMode     =   1  'UseZOrder
  10.    ScaleHeight     =   4140
  11.    ScaleWidth      =   6690
  12.    StartUpPosition =   2  'CenterScreen
  13.    Begin VB.CommandButton cmdExit 
  14.       Caption         =   "E&xit"
  15.       Height          =   375
  16.       Left            =   5640
  17.       TabIndex        =   7
  18.       Top             =   3600
  19.       Width           =   975
  20.    End
  21.    Begin VB.CommandButton cmdShow 
  22.       Caption         =   "&Show Image"
  23.       Height          =   375
  24.       Left            =   4200
  25.       TabIndex        =   6
  26.       Top             =   3600
  27.       Width           =   1215
  28.    End
  29.    Begin VB.DriveListBox drvImage 
  30.       Height          =   315
  31.       Left            =   2280
  32.       TabIndex        =   5
  33.       Top             =   3720
  34.       Width           =   1575
  35.    End
  36.    Begin VB.FileListBox filImage 
  37.       Height          =   2820
  38.       Left            =   120
  39.       Pattern         =   "*.bmp;*.ico;*.wmf;*.gif;*.jpg"
  40.       TabIndex        =   1
  41.       Top             =   1080
  42.       Width           =   2055
  43.    End
  44.    Begin VB.DirListBox dirImage 
  45.       Height          =   2055
  46.       Left            =   2280
  47.       TabIndex        =   0
  48.       Top             =   1080
  49.       Width           =   1575
  50.    End
  51.    Begin VB.Image imgImage 
  52.       BorderStyle     =   1  'Fixed Single
  53.       Height          =   2895
  54.       Left            =   4440
  55.       Stretch         =   -1  'True
  56.       Top             =   360
  57.       Width           =   1935
  58.    End
  59.    Begin VB.Shape Shape2 
  60.       BackColor       =   &H00FFFFFF&
  61.       BackStyle       =   1  'Opaque
  62.       FillColor       =   &H0000FF00&
  63.       Height          =   2895
  64.       Left            =   4440
  65.       Top             =   360
  66.       Width           =   1935
  67.    End
  68.    Begin VB.Shape Shape1 
  69.       BackColor       =   &H00FFFF00&
  70.       BackStyle       =   1  'Opaque
  71.       FillColor       =   &H00FF0000&
  72.       FillStyle       =   4  'Upward Diagonal
  73.       Height          =   3375
  74.       Left            =   4200
  75.       Shape           =   4  'Rounded Rectangle
  76.       Top             =   120
  77.       Width           =   2415
  78.    End
  79.    Begin VB.Label lblImage 
  80.       BackColor       =   &H0080FFFF&
  81.       BorderStyle     =   1  'Fixed Single
  82.       Height          =   375
  83.       Left            =   120
  84.       TabIndex        =   8
  85.       Top             =   120
  86.       Width           =   3735
  87.    End
  88.    Begin VB.Line Line1 
  89.       BorderWidth     =   3
  90.       X1              =   4080
  91.       X2              =   4080
  92.       Y1              =   120
  93.       Y2              =   3960
  94.    End
  95.    Begin VB.Label Label3 
  96.       Caption         =   "Drives:"
  97.       Height          =   375
  98.       Left            =   2280
  99.       TabIndex        =   4
  100.       Top             =   3360
  101.       Width           =   1215
  102.    End
  103.    Begin VB.Label Label2 
  104.       Caption         =   "Directories:"
  105.       Height          =   375
  106.       Left            =   2280
  107.       TabIndex        =   3
  108.       Top             =   720
  109.       Width           =   1215
  110.    End
  111.    Begin VB.Label Label1 
  112.       Caption         =   "Files:"
  113.       Height          =   375
  114.       Left            =   120
  115.       TabIndex        =   2
  116.       Top             =   720
  117.       Width           =   1215
  118.    End
  119. Attribute VB_Name = "frmImage"
  120. Attribute VB_GlobalNameSpace = False
  121. Attribute VB_Creatable = False
  122. Attribute VB_PredeclaredId = True
  123. Attribute VB_Exposed = False
  124. Option Explicit
  125. Private Sub cmdExit_Click()
  126. End Sub
  127. Private Sub cmdShow_Click()
  128. 'Put image file name together and
  129. 'load image into image box
  130. Dim ImageName As String
  131. 'Check to see if filename blank
  132. If filImage.filename = "" Then Exit Sub
  133. 'Check to see if at root directory
  134. If Right(filImage.Path, 1) = "\" Then
  135.   ImageName = filImage.Path + filImage.filename
  136.   ImageName = filImage.Path + "\" + filImage.filename
  137. End If
  138. lblImage.Caption = ImageName
  139. imgImage.Picture = LoadPicture(ImageName)
  140. End Sub
  141. Private Sub dirImage_Change()
  142. 'If directory changes, update file path
  143. filImage.Path = dirImage.Path
  144. End Sub
  145. Private Sub drvImage_Change()
  146. 'If drive changes, update directory
  147. dirImage.Path = drvImage.Drive
  148. End Sub
  149. Private Sub filImage_DblClick()
  150. Call cmdShow_Click
  151. End Sub
  152.